Add testProcess{Config} task to accept user options#581
Conversation
…ptions argument to tests
CI Test ResultsRun: #27158474248 | Commit:
Status Overview
Legend: ✅ passed | ❌ failed | ⚪ skipped | 🚫 cancelled Summary: Total: 32 | Passed: 32 | Failed: 0 Updated: 2026-06-08 18:44:52 UTC |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6f5c7bae36
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| String userOptions = System.getProperty("ddprof.test.options"); | ||
| if (userOptions != null && !userOptions.isEmpty()) { | ||
| profilerCommand = mergeProfilerOptions(profilerCommand, userOptions); |
There was a problem hiding this comment.
Apply profiler options to all profiler starts
When testProcessDebug is run without -Ptests, this system property is only consumed by AbstractProfilerTest; tests that call JavaProfiler.execute(...) directly still start the profiler with their hard-coded commands (for example ShutdownTest.runTest and OtelContextStorageModeTest). That means a process run requested with -Pprofiler.options=fjmethodid=false still exercises part of the suite with the default profiler options, so it is not a reliable way to validate that option across the task's full test set.
Useful? React with 👍 / 👎.
| } | ||
|
|
||
| // Apply overrides | ||
| for (String part : overrides.split(",")) { |
There was a problem hiding this comment.
🔵 LOW · robustness [GENERALIST]
A valueless override token (e.g. -Pprofiler.options=cpu) silently clears the value of a matching base option: cpu=10ms in the base becomes bare cpu in the merged result. Easy to trigger accidentally and undocumented.
Suggestion: Document this behavior in the mergeProfilerOptions Javadoc so users know that a bare key override strips any existing value. Alternatively, use putIfAbsent to avoid overwriting an existing valued key with an empty one:
else if (!part.isEmpty()) {
options.putIfAbsent(part, "");
}There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a13c32a888
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // Skip key with empty value | ||
| if (!entry.getValue().isEmpty()) { |
There was a problem hiding this comment.
Preserve empty-valued profiler options
When testProcessDebug is run with any -Pprofiler.options, the merge path rebuilds every base command and drops entries whose value is empty. That changes existing tests such as VirtualThreadWallClockTest, whose base command is wall=1ms,filter=; adding an unrelated override like -Pprofiler.options=fjmethodid=false silently removes filter= (and can leave a doubled comma), so the new task no longer runs the same profiler configuration plus the requested override.
Useful? React with 👍 / 👎.
What does this PR do?:
This PR adds a new task for testing, that accepts user options.
Motivation:
The task is created for testing new feature that avoids preloading all jmethod ids. By default, the feature is disabled and has to be enabled via
fjmethodid=falseargument, which is not possible with currenttestdebug/releasetasks.Additional Notes:
How to test the change?:
Run
./gradlew Pprofiler.options=fjmethodid=false testProcessDebug,fjmethodid=falseis merged into command line that print out by tests.For example:
For Datadog employees:
credentials of any kind, I've requested a review from
@DataDog/security-design-and-guidance.Unsure? Have a question? Request a review!